home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / WIN_PRO / WTEK0593.ZIP;1 / EDIT-CPP.ZIP / EDITOR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-11  |  4.5 KB  |  164 lines

  1. // editor.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "editor.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "editodoc.h"
  9. #include "editovw.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CEditorApp
  18.  
  19. BEGIN_MESSAGE_MAP(CEditorApp, CWinApp)
  20.     //{{AFX_MSG_MAP(CEditorApp)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code !
  24.     //}}AFX_MSG_MAP
  25.     // Standard file based document commands
  26.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  27.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  28.     // Standard print setup command
  29.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  30.     // Global help commands
  31.     ON_COMMAND(ID_HELP_INDEX, CWinApp::OnHelpIndex)
  32.     ON_COMMAND(ID_HELP_USING, CWinApp::OnHelpUsing)
  33.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  34.     ON_COMMAND(ID_CONTEXT_HELP, CWinApp::OnContextHelp)
  35.     ON_COMMAND(ID_DEFAULT_HELP, CWinApp::OnHelpIndex)
  36. END_MESSAGE_MAP()
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CEditorApp construction
  40.  
  41. CEditorApp::CEditorApp()
  42. {
  43.     // TODO: add construction code here,
  44.     // Place all significant initialization in InitInstance
  45. }
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // The one and only CEditorApp object
  49.  
  50. CEditorApp NEAR theApp;
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CEditorApp initialization
  54.  
  55. BOOL CEditorApp::InitInstance()
  56. {
  57.     // Standard initialization
  58.     // If you are not using these features and wish to reduce the size
  59.     //  of your final executable, you should remove from the following
  60.     //  the specific initialization routines you do not need.
  61.  
  62.     SetDialogBkColor();        // set dialog background color to gray
  63.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  64.     EnableVBX();               // Initialize VBX support
  65.  
  66.     // Register the application's document templates.  Document templates
  67.     //  serve as the connection between documents, frame windows and views.
  68.  
  69.     AddDocTemplate(new CMultiDocTemplate(IDR_EDITORTYPE,
  70.             RUNTIME_CLASS(CEditorDoc),
  71.             RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  72.             RUNTIME_CLASS(CEditView)));
  73.     OnAppAbout();
  74.     // create main MDI Frame window
  75.     CMainFrame* pMainFrame = new CMainFrame;
  76.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  77.         return FALSE;
  78.     pMainFrame->ShowWindow(m_nCmdShow);
  79.     pMainFrame->UpdateWindow();
  80.     m_pMainWnd = pMainFrame;
  81.  
  82.     // enable file manager drag/drop and DDE Execute open
  83.     m_pMainWnd->DragAcceptFiles();
  84.     EnableShellOpen();
  85.     RegisterShellFileTypes();
  86.  
  87.     // simple command line parsing
  88.     if (m_lpCmdLine[0] == '\0')
  89.     {
  90.         // create a new (empty) document
  91.         OnFileNew();
  92.     }
  93.     else if ((m_lpCmdLine[0] == '-' || m_lpCmdLine[0] == '/') &&
  94.         (m_lpCmdLine[1] == 'e' || m_lpCmdLine[1] == 'E'))
  95.     {
  96.         // program launched embedded - wait for DDE or OLE open
  97.     }
  98.     else
  99.     {
  100.         // open an existing document
  101.         OpenDocumentFile(m_lpCmdLine);
  102.     }
  103.  
  104.     return TRUE;
  105. }
  106.  
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CAboutDlg dialog used for App About
  109.  
  110. class CAboutDlg : public CDialog
  111. {
  112. public:
  113.     CAboutDlg();
  114.  
  115. // Dialog Data
  116.     //{{AFX_DATA(CAboutDlg)
  117.     enum { IDD = IDD_ABOUTBOX };
  118.     //}}AFX_DATA
  119.  
  120. // Implementation
  121. protected:
  122.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  123.     //{{AFX_MSG(CAboutDlg)
  124.         // No message handlers
  125.     //}}AFX_MSG
  126.     DECLARE_MESSAGE_MAP()
  127. };
  128.  
  129. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  130. {
  131.     //{{AFX_DATA_INIT(CAboutDlg)
  132.     //}}AFX_DATA_INIT
  133. }
  134.  
  135. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  136. {
  137.     CDialog::DoDataExchange(pDX);
  138.     //{{AFX_DATA_MAP(CAboutDlg)
  139.     //}}AFX_DATA_MAP
  140. }
  141.  
  142. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  143.     //{{AFX_MSG_MAP(CAboutDlg)
  144.         // No message handlers
  145.     //}}AFX_MSG_MAP
  146. END_MESSAGE_MAP()
  147.  
  148. // App command to run the dialog
  149. void CEditorApp::OnAppAbout()
  150. {
  151.     CAboutDlg aboutDlg;
  152.     aboutDlg.DoModal();
  153. }
  154.  
  155. /////////////////////////////////////////////////////////////////////////////
  156. // VB-Event registration
  157. // (calls to AfxRegisterVBEvent will be placed here by ClassWizard)
  158.  
  159. //{{AFX_VBX_REGISTER_MAP()
  160. //}}AFX_VBX_REGISTER_MAP
  161.  
  162. /////////////////////////////////////////////////////////////////////////////
  163. // CEditorApp commands
  164.